﻿#if ATS
using System.ComponentModel.DataAnnotations;
#endif
using ATS.Enums;

namespace ATS.Dto;

public class ProductItemDto
{
    /// <summary>
    /// 产品ID
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// 产品型号
    /// </summary>
    public string Model { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 条码规则，正则表达式
    /// </summary>
    public string CodeRule { get; set; }

    /// <summary>
    /// 正常\冻结
    /// </summary>
    public EFrozenStatus Status { get; set; }

    /// <summary>
    /// 扩展信息，JSON
    /// </summary>
    public string? Extension { get; set; }

    /// <summary>
    /// 默认生产工艺ID。冗余
    /// </summary>
    public string? DefaultManufacturingId { get; set; }

    /// <summary>
    /// 生产状态
    /// </summary>
    public EProductionStatus ProductionStatus { get; set; }

    /// <summary>
    /// 物料编码。同一外部系统（ClientId)下唯一
    /// </summary>
    public string? MaterialCode { get; set; }
}



public class ProductCreateInput
{
    /// <summary>
    /// 产品名称
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
#endif
    public string Name { get; set; }

    /// <summary>
    /// 物料编码
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
    [RegularExpression(GlobalOptions.RegexStrings.EnDigitUnderline, ErrorMessage = GlobalOptions.RegexStrings.EnDigitUnderlineError)]
#endif
    public string MaterialCode { get; set; }

    /// <summary>
    /// 产品型号
    /// </summary>
#if ATS
    [Required(ErrorMessage = "{0}不能为空")]
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
    [RegularExpression(GlobalOptions.RegexStrings.EnDigitUnderline, ErrorMessage = GlobalOptions.RegexStrings.EnDigitUnderlineError)]
#endif
    public string Model { get; set; }

    /// <summary>
    /// 产品描述
    /// </summary>
#if ATS
    [StringLength(255, ErrorMessage = "{0}长度不能超过255")]
#endif
    public string? Description { get; set; }
}